#include <QDebug>
#include "puck.h"
#include "object_builder.h"
#include "utils/debug.h"

Puck::Puck(float radius, float height, int numPoints):
    m_radius(radius), m_height(height), m_numPoints(numPoints) {
    // 分配顶点内存
    int vertexSize = circleVertexSize(numPoints) + openCylinderVertexSize(numPoints);
    // 三维坐标
    m_vertexData = new float[vertexSize * 3];
    // 圆筒 
    Point3D center(0.f, height/2.f, 0.f);
    m_cylinder = new Cylinder3D(center, radius, height);
    // 上圆盘
    center.translateY(height/2.f);
    m_topCircle = new Circle3D(center, radius);
    // 坐标数据
    int start = appendCircle(m_vertexData, 0, m_topCircle, numPoints);
    appendOpenCylinder(m_vertexData, start, m_cylinder, numPoints);
};
